home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / nwtp06 / tstconn2.pas < prev    next >
Pascal/Delphi Source File  |  1996-07-10  |  4KB  |  127 lines

  1. {$X+,V-,B-}
  2. program tstconn2;
  3.  
  4. { Testprogram for the nwConn unit / NwTP 0.6 API. (c) 1993, 1995, R.Spronk }
  5.  
  6. { Purpose: testing of nwConn calls }
  7.  
  8. { Tests the following nwConn functions:
  9.  
  10.   GetConnectionIdTable
  11.   GetEndOfJobStatus
  12.   GetPrimaryConnectionId
  13.   GetNetwareErrorMode
  14.   GetNetwareShellVersion
  15.   GetWorkstationEnvironment
  16.   SetEndOfJobStatus
  17.   SetNetwareErrorMode
  18.   SetPrimaryConnectionId
  19.  
  20. }
  21.  
  22. uses nwMisc,nwConn;
  23.  
  24. Var MajorVersion,MinorVersion,RevisionLevel:byte;
  25.     OStype,OSversion,HardwareType,ShortHWType :string;
  26.  
  27.     primConnId,TestConnId:byte;
  28.  
  29.     c:byte;
  30.     ConnInfo:TconnectionIDtableEntry;
  31.  
  32.     status,status1:boolean;
  33.  
  34.     mode,mode1:byte;
  35.  
  36. begin
  37. Writeln('Testing GetNWshellVersion.');
  38. IF GetNetwareShellVersion(MajorVersion,MinorVersion,RevisionLevel)
  39.  then begin
  40.       write(' Shell version: ',MajorVersion,'.',Minorversion);
  41.       if RevisionLevel>0
  42.        then writeln(' Rev.',chr(ord('A')+RevisionLevel-1))
  43.        else writeln;
  44.       if MajorVersion>=3
  45.        then begin
  46.             writeln;
  47.             Writeln('Testing GetWSEnvironment.');
  48.             IF GetWorkstationEnvironment(OStype,OSversion,
  49.                               HardwareType,ShortHWType)
  50.              then begin
  51.                   writeln(' OStype      :',OStype);
  52.                   writeln(' OSversion   :',OSversion);
  53.                   writeln(' HardwareType:',HardwareType);
  54.                   writeln(' ShortHWtype :',ShortHWtype);
  55.                   end
  56.              else writeln('GetWSenvironment returned error#:',HexStr(nwConn.result,2));
  57.  
  58.  
  59.  
  60.             end;
  61.       end
  62.  else writeln('GetNWshellversion returned error#:',HexStr(nwConn.result,2));
  63.  
  64. writeln;
  65. writeln('Tesing SetPrimaryConnectionId.');
  66. GetPrimaryConnectionId(primConnId);
  67. writeln(' Primary connId=',primConnId);
  68. IF SetPrimaryConnectionId(0)
  69.  then begin
  70.       writeln(' OK. prim.connid set to 0');
  71.       GetPrimaryConnectionId(testConnId);
  72.       if testConnId<>0
  73.        then writeln('ERR. primary connection wasn''t changed.');
  74.       end;
  75. SetPrimaryConnectionId(primConnId);
  76. GetPrimaryConnectionId(testConnId);
  77. If testConnId=primConnId
  78.  then writeln(' Primary connId reset to ',testConnId)
  79.  else writeln('Error setting primary connectionId');
  80.  
  81. writeln;
  82. writeln('Testing GetConnectionIDtable.');
  83. for c:=1 to 8
  84.  do begin
  85.     GetConnectionIdTable(c,ConnInfo);
  86.     if ConnInfo.SlotInuse>0
  87.      then with ConnInfo
  88.           do begin
  89.              writeln(' Data for server with connId=',c);
  90.              Writeln('  Adress of server :$',HexDumpstr(ServerAddress,24),' (net,node HI-LO, socket LO-HI)');
  91.              Writeln('  Router address   :$',HexDumpStr(RouterAddress,12));
  92.              writeln('  My connection Nbr:',ConnectionNumber);
  93.              writeln('  Connection Status:$',hexStr(connectionStatus,2));
  94.  
  95.              end;
  96.  
  97.     end;
  98.  
  99. writeln;
  100. writeln('Testing Set/Get endOfJobStatus');
  101. GetEndOfJobStatus(status);
  102. SetEndOfJobStatus(NOT status);
  103. GetEndOfJobStatus(status1);
  104. if status1=NOT status
  105.  then writeln(' Tested OK.')
  106.  else writeln(' Error: test failed.');
  107. SetEndOfJobStatus(status);
  108. GetEndOfJobStatus(status1);
  109. if status1=status
  110.  then writeln(' EOJ status reset to original mode.')
  111.  else writeln('Err: status not reset to original mode.');
  112.  
  113. writeln;
  114. writeln('Testing Set/Get netwareErrorMode.');
  115. GetNetwareErrorMode(mode);
  116. SetNetwareErrorMode(2);
  117. GetNetwareErrorMode(mode1);
  118. if mode1=2
  119.  then writeln(' Tested OK.')
  120.  else writeln(' Error: test failed.');
  121. SetNetwareErrorMode(mode);
  122. GetNetwareErrorMode(mode1);
  123. if mode1=mode
  124.  then writeln(' Error Mode reset to original mode.')
  125.  else writeln('Err: error mode not reset to original mode.');
  126.  
  127. end.